package conf

import (
	"github.com/spf13/viper"
	"go.uber.org/zap"
)

// SmsSection map toml [sms]
type SmsSection struct {
	ScfEndPoint string `mapstructure:"scf_end_point"`
	SignName    string `mapstructure:"sign_name"`
	AppID       string `mapstructure:"app_id"`
}

// ReadSms get sms section from config
func ReadSms(v *viper.Viper, slog *zap.SugaredLogger) (smsConfPtr *SmsSection) {
	smsConfPtr = &SmsSection{}
	err := v.Unmarshal(smsConfPtr)
	if err != nil {
		slog.Panicf("unable to decode into sms section, %v", err)
	}
	return
}
